package com.ruoyi.yyq.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Exchange;
import org.springframework.amqp.core.ExchangeBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.QueueBuilder;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CarRepairReservationRabbitMQConfig {
//	编写维修预约消息队列配置
	//定义交换机
	@Bean("CarRepairReservation_exchange")
	public Exchange fanoutExchange(){
	return ExchangeBuilder.fanoutExchange("CarRepairReservation_exchange").durable(true).build();
	}
//	定义队列
	@Bean("CarRepairReservation_queue")
	public Queue topicQueue1() {
		return QueueBuilder.durable("CarRepairReservation_queue").build();
	}
// 绑定
	@Bean
	public Binding Exchange(@Qualifier("CarRepairReservation_queue") Queue queue, @Qualifier("CarRepairReservation_exchange") Exchange exchange){
		return BindingBuilder.bind(queue).to(exchange).with("").noargs();
	}

}
